//
//  MPTLiveGuideViewController.m
//  MPTLive
//
//  Created by caixun on 15/10/9.
//  Copyright © 2015年 Jeakin. All rights reserved.
//

#import "MPTLiveGuideViewController.h"

@interface MPTLiveGuideViewController ()

@end

@implementation MPTLiveGuideViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    // 如果某个UIViewController的self.view第一个子视图是UIScollView，同时当这个UIViewController被push或 initWithRootController成为UINavigationController控制的Controller时，这个 UIViewController的view的子视图UIScollView的所有子视图，都会被下移64px。
    self.automaticallyAdjustsScrollViewInsets = NO;
    
    UIScrollView *guide = [[UIScrollView alloc] initWithFrame:self.view.frame];
    guide.contentSize = CGSizeMake(self.view.frame.size.width*4, 0);
    guide.pagingEnabled = YES;
    [self.view addSubview:guide];
    
    // 返回按钮
    UIImage *close = [UIImage imageNamed:@"LiveOverClose"];
    UIImage *closePress = [UIImage imageNamed:@"LiveOverClosePress"];
    CGRect closeRect = CGRectMake(screenW - 60, 0, 60, 60);
    UIButton *goBackBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    goBackBtn.frame = closeRect;
    [goBackBtn setImage:close forState:UIControlStateNormal];
    [goBackBtn setImage:closePress forState:UIControlStateHighlighted];
    [goBackBtn addTarget:self action:@selector(onClickForGoBack:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:goBackBtn];
    
    
    if(iPhone4)
    {
        UIImageView *iphone4Guide1 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Iphone4Guide1"]];
        iphone4Guide1.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
        
        UIImageView *iphone4Guide2 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Iphone4Guide2"]];
        iphone4Guide2.frame = CGRectMake(self.view.frame.size.width, 0, self.view.frame.size.width, self.view.frame.size.height);
        
        UIImageView *iphone4Guide3 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Iphone4Guide3"]];
        iphone4Guide3.frame = CGRectMake(self.view.frame.size.width*2, 0, self.view.frame.size.width, self.view.frame.size.height);
        
        UIImageView *iphone4Guide4 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Iphone4Guide4"]];
        iphone4Guide4.frame = CGRectMake(self.view.frame.size.width*3, 0, self.view.frame.size.width, self.view.frame.size.height);
        
        [guide addSubview:iphone4Guide1];
        [guide addSubview:iphone4Guide2];
        [guide addSubview:iphone4Guide3];
        [guide addSubview:iphone4Guide4];
    }
    else if(iPhone5)
    {
        UIImageView *iphone5Guide1 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Iphone5Guide1"]];
        iphone5Guide1.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
        
        UIImageView *iphone5Guide2 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Iphone5Guide2"]];
        iphone5Guide2.frame = CGRectMake(self.view.frame.size.width, 0, self.view.frame.size.width, self.view.frame.size.height);
        
        UIImageView *iphone5Guide3 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Iphone5Guide3"]];
        iphone5Guide3.frame = CGRectMake(self.view.frame.size.width*2, 0, self.view.frame.size.width, self.view.frame.size.height);
        
        UIImageView *iphone5Guide4 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Iphone5Guide4"]];
        iphone5Guide4.frame = CGRectMake(self.view.frame.size.width*3, 0, self.view.frame.size.width, self.view.frame.size.height);
        
        
        [guide addSubview:iphone5Guide1];
        [guide addSubview:iphone5Guide2];
        [guide addSubview:iphone5Guide3];
        [guide addSubview:iphone5Guide4];
    }
    else if(iPhone6)
    {
        UIImageView *iphone6Guide1 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Iphone6Guide1"]];
        iphone6Guide1.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
        
        UIImageView *iphone6Guide2 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Iphone6Guide2"]];
        iphone6Guide2.frame = CGRectMake(self.view.frame.size.width, 0, self.view.frame.size.width, self.view.frame.size.height);
        
        UIImageView *iphone6Guide3 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Iphone6Guide3"]];
        iphone6Guide3.frame = CGRectMake(self.view.frame.size.width*2, 0, self.view.frame.size.width, self.view.frame.size.height);
        
        UIImageView *iphone6Guide4 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Iphone6Guide4"]];
        iphone6Guide4.frame = CGRectMake(self.view.frame.size.width*3, 0, self.view.frame.size.width, self.view.frame.size.height);
        
        
        [guide addSubview:iphone6Guide1];
        [guide addSubview:iphone6Guide2];
        [guide addSubview:iphone6Guide3];
        [guide addSubview:iphone6Guide4];
    }
    else if(iPhone6p)
    {
        UIImageView *iphone6pGuide1 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Iphone6pGuide1"]];
        iphone6pGuide1.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
        
        UIImageView *iphone6pGuide2 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Iphone6pGuide2"]];
        iphone6pGuide2.frame = CGRectMake(self.view.frame.size.width, 0, self.view.frame.size.width, self.view.frame.size.height);
        
        UIImageView *iphone6pGuide3 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Iphone6pGuide3"]];
        iphone6pGuide3.frame = CGRectMake(self.view.frame.size.width*2, 0, self.view.frame.size.width, self.view.frame.size.height);
        
        UIImageView *iphone6pGuide4 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Iphone6pGuide4"]];
        iphone6pGuide4.frame = CGRectMake(self.view.frame.size.width*3, 0, self.view.frame.size.width, self.view.frame.size.height);
        
        
        [guide addSubview:iphone6pGuide1];
        [guide addSubview:iphone6pGuide2];
        [guide addSubview:iphone6pGuide3];
        [guide addSubview:iphone6pGuide4];
    }
    else
    {
        UIImageView *iphone6pGuide1 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Iphone6pGuide1"]];
        iphone6pGuide1.contentMode = UIViewContentModeScaleAspectFit;
        iphone6pGuide1.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
        
        UIImageView *iphone6pGuide2 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Iphone6pGuide2"]];
        iphone6pGuide2.contentMode = UIViewContentModeScaleAspectFit;
        iphone6pGuide2.frame = CGRectMake(self.view.frame.size.width, 0, self.view.frame.size.width, self.view.frame.size.height);
        
        UIImageView *iphone6pGuide3 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Iphone6pGuide3"]];
        iphone6pGuide3.contentMode = UIViewContentModeScaleAspectFit;
        iphone6pGuide3.frame = CGRectMake(self.view.frame.size.width*2, 0, self.view.frame.size.width, self.view.frame.size.height);
        
        UIImageView *iphone6pGuide4 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Iphone6pGuide4"]];
        iphone6pGuide4.contentMode = UIViewContentModeScaleAspectFit;
        iphone6pGuide4.frame = CGRectMake(self.view.frame.size.width*3, 0, self.view.frame.size.width, self.view.frame.size.height);
        
        
        [guide addSubview:iphone6pGuide1];
        [guide addSubview:iphone6pGuide2];
        [guide addSubview:iphone6pGuide3];
        [guide addSubview:iphone6pGuide4];
    }
}

- (void)onClickForGoBack:(id)sender
{
    [self.navigationController popViewControllerAnimated:YES];
}

@end
